package com.hz.controller;

import com.aliyun.oss.common.utils.DateUtil;
import com.hz.dao.WithdrawDepositDao;
import com.hz.pojo.WithdrawDeposit;
import com.hz.service.WithdrawDepositService;
import com.hz.utils.DateUtils;
import com.hz.utils.MassageJsons;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/WithdrawDeposit")
public class WithdrawDepositController {

    @Resource
    private WithdrawDepositService withdrawDepositService;
    @Resource
    WithdrawDepositDao withdrawDepositDao;

    @RequestMapping("/getWithdrawDepositList")
    public MassageJsons getWithdrawDepositList(String open_id,Integer withdrawDeposit_getmoney_state){
        List<WithdrawDeposit> withdrawDepositList = null;
        try {
            withdrawDepositList = withdrawDepositService.getWithdrawDepositList(open_id,withdrawDeposit_getmoney_state);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return new MassageJsons("0","请求成功",withdrawDepositList);
    }

    /**
     * 修改提现状态
     * @param withdrawDeposit   修改信息
     * @return
     */
    @RequestMapping("/updWithdrawDepositGetmoneyState")
    public MassageJsons updWithdrawDepositGetmoneyState(WithdrawDeposit withdrawDeposit){



        try {
            //添加审核时间
            withdrawDeposit.setWithdrawDeposit_review_time(DateUtils.getCurrentTime());
            withdrawDepositService.updWithdrawDepositGetmoneyState(withdrawDeposit);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return new MassageJsons("0","提交成功");
    }
}
